<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Psa_Plugin_Before_User_Create</title>
			<link rel="stylesheet" href="../../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../../media/images/AbstractClass_logo.png"
														alt="Abstract Class"
														title="Abstract Class"
														style="vertical-align: middle"> Psa_Plugin_Before_User_Create</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
													<a href="#sec-vars">Vars</a>
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Abstract class for plugins type of <em>Psa_Plugin_Before_User_Create</em>.</p>
<p class="description"><p>You can start new user creation process by passing '<kbd>new</kbd>' to <a href="../../psa/Psa_User.html">Psa_User</a> class constructor. See  <a href="../../psa/Psa_User.html#method__construct">constructor</a> method of <a href="../../psa/Psa_User.html">Psa_User</a> class.</p><p>Before new user is tried to be created with <a href="../../psa/Psa_User.html#methodsave">save()</a> method of the <a href="../../psa/Psa_User.html">Psa_User</a> object,  <a href="../../psa/plugins/Psa_Plugin_Before_User_Create.html#methodpsa_main">psa_main()</a> method of the plugin object that extends this class will be called.  You can write <em>Psa_Plugin_Before_User_Create</em> plugins by extending this class. Here is an example:</p><p><div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-key">class&nbsp;</span><span class="src-id">my_plugin&nbsp;</span><span class="src-key">extends&nbsp;</span><a href="../../psa/plugins/Psa_Plugin_Before_User_Create.html">Psa_Plugin_Before_User_Create</a><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;you&nbsp;have&nbsp;to&nbsp;define&nbsp;psa_main()&nbsp;method&nbsp;in&nbsp;your&nbsp;child&nbsp;class</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><span class="src-id">psa_main</span><span class="src-sym">(</span><span class="src-var">$user</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;set&nbsp;some&nbsp;property&nbsp;to&nbsp;new&nbsp;user</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$user</span><span class="src-sym">-&gt;</span><span class="src-id">favorite_background_color&nbsp;</span>=&nbsp;<span class="src-str">'white'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;you&nbsp;can&nbsp;put&nbsp;here&nbsp;any&nbsp;logic&nbsp;you&nbsp;need</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-php">?&gt;</span></div></li>
</ol></div></p><p>When this example plugin is registered every new created user will have property called  <kbd>favorite_background_color</kbd> with value '<kbd>white</kbd>'.</p><p><strong>Note:</strong> this plugin is called before the new user is created and saved to database. Because of that  this plugin will be called even if the user is not created due to some error like user with same userneme  already exists in the database. If you set some property to user like <em>favorite_background_color</em> in  example above and user is successfully created this property will be saved to the database and you don't have to call  save() method later to store it. That is unlike <a href="../../psa/plugins/Psa_Plugin_After_User_Create.html">Psa_Plugin_After_User_Create</a> plugin.  Also, user ID is unknown when this plugin is called and is set after the user is created.</p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../../psa/plugins/Psa_Plugin_After_User_Create.html">Psa_Plugin_After_User_Create</a></li>
				<li><span class="field">see:</span> <a href="../../psa/Psa_User.html">Psa_User</a></li>
				<li><span class="field">see:</span> <a href="../../psa/Psa_User.html#method__construct">Psa_User::__construct()</a></li>
				<li><span class="field">see:</span> <a href="../../psa/Psa_User.html#methodsave">Psa_User::save()</a></li>
				<li><span class="field">abstract:</span> </li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_plugin_classes---Psa_Plugin_Before_User_Create.class.php.html">/plugin_classes/Psa_Plugin_Before_User_Create.class.php</a> (line <span class="field"><a href="../../__filesource/fsource_psa_plugins_plugin_classesPsa_Plugin_Before_User_Create.class.php.html#a69">69</a></span>)
		</p>
		
				
		<pre><a href="../../psa/plugins/Psa_Plugin_Model.html">Psa_Plugin_Model</a>
   |
   --Psa_Plugin_Before_User_Create</pre>
	
			</div>
</div>




	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-vars">Vars</a>
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																								<div class="method-definition">
					<img src="../../media/images/AbstractMethod.png" alt=" "/>
											<span class="method-result">void</span>
										<a href="#psa_main" title="details" class="method-name">psa_main</a>
											(<span class="var-type"><a href="../../psa/Psa_User.html">Psa_User</a></span>&nbsp;<span class="var-name">$user_object</span>)
									</div>
											</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			
							<h4>Inherited Variables</h4>
				<A NAME='inherited_vars'><!-- --></A>
									<p>Inherited from <span class="classname"><a href="../../psa/plugins/Psa_Plugin_Model.html">Psa_Plugin_Model</a></span></p>
					<blockquote>
													<img src="../../media/images/Variable.png" />
							<span class="var-title">
								<span class="var-name"><a href="../../psa/plugins/Psa_Plugin_Model.html#var$psa_database">Psa_Plugin_Model::$psa_database</a></span><br>
							</span>
													<img src="../../media/images/Variable.png" />
							<span class="var-title">
								<span class="var-name"><a href="../../psa/plugins/Psa_Plugin_Model.html#var$psa_registry">Psa_Plugin_Model::$psa_registry</a></span><br>
							</span>
													<img src="../../media/images/Variable.png" />
							<span class="var-title">
								<span class="var-name"><a href="../../psa/plugins/Psa_Plugin_Model.html#var$psa_result">Psa_Plugin_Model::$psa_result</a></span><br>
							</span>
											</blockquote> 
										
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-vars">Vars</a>
														<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodpsa_main" id="psa_main"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../../media/images/AbstractMethod.png" />
		<span class="method-title">psa_main</span> (line <span class="line-number"><a href="../../__filesource/fsource_psa_plugins_plugin_classesPsa_Plugin_Before_User_Create.class.php.html#a76">76</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This method will be called before the new user is tried to be created with <a href="../../psa/Psa_User.html#methodsave">save()</a>  method of the <a href="../../psa/Psa_User.html">Psa_User</a> object.</p>
	<ul class="tags">
				<li><span class="field">abstract:</span> </li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			psa_main
		</span>
					(<span class="var-type"><a href="../../psa/Psa_User.html">Psa_User</a></span>&nbsp;<span class="var-name">$user_object</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"><a href="../../psa/Psa_User.html">Psa_User</a></span>
				<span class="var-name">$user_object</span><span class="var-description">: reference to the <a href="../../psa/Psa_User.html">Psa_User</a> object whose <a href="../../psa/Psa_User.html#methodsave">save()</a> method is invoked</span>			</li>
				</ul>
		
			
	</div>
							<h4>Inherited Methods</h4>
				<a name='inherited_methods'><!-- --></a>	
									<!-- =========== Summary =========== -->
					<p>Inherited From <span class="classname"><a href="../../psa/plugins/Psa_Plugin_Model.html">Psa_Plugin_Model</a></span></p>
					<blockquote>
													<img src="../../media/images/Constructor.png" alt=" "/>
							<span class="method-name"><a href="../../psa/plugins/Psa_Plugin_Model.html#method__construct">Psa_Plugin_Model::__construct()</a></span><br>
											</blockquote>
										
		</div>
	</div>

	
	<p class="notes" id="credit">
		Documentation generated on Thu, 21 Oct 2010 01:40:53 +0200 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
	</p>
	</div></body>
</html>